{extend name="$admin_layout" /}
{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="box nav-tabs-custom">
            <div class="box-body">
                <div class="box-header with-border">
                    <h5 class="box-title" style="font-size: 14px;">订单基础信息</h5>
                </div>
                <table class="table table-bordered">
                    <thead>

                    <tr>
                        <th> <span class="label label-flat label-success">{$detail.order_type_title}</span>	订单号</th>
                        <th>订单总付款</th>
                        <th>累计已退款</th>
                        <th>支付状态</th>
						<th>支付方式</th>
                        <th>订单状态</th>
                        <th>下单时间</th>
                    </tr>
                    </thead>
                    <tbody>
						<tr>
							<td>{$order_info.order_sn}</td>                       
							<td>{$order_info.payable_money}</td>
							<td>{$order_info.total_refund_money}</td>
							<td>{if condition="$order_info.pay_status eq '0'"}
								未付款
								{elseif condition="$order_info.pay_status eq '1'"/}已支付{/if}</td>
							<td><span class="label label-flat label-success">{$order_info.pay_type}</span></td>
							<td>{$order_info.order_status}</td>
							<td>{$order_info.create_time}</td>
						</tr>
                    </tbody>
                </table>
                <div class="box-header">
							<h5 class="box-title" style="font-size: 14px;">订单退货信息</h5>
				</div>
                <div style="display:block" class="row">
                    <div class="col-lg-8">
					  
                        <table class="table table-builder table-hover">
						
                            <tr>
                                <td style="width: 15%;"><b>退货原因</b></td><td>{$detail.refund_reason}</td>
                            </tr>
                            <tr>
                                <td style="width: 15%;"><b>退货说明</b></td><td>{$detail.refund_content}</td>
                            </tr>
                            <tr>
                                <td style="width: 15%;"><b>退货图片</b></td><td>
								{foreach name="$detail.refund_picture" item="v"}
								<div  class="uploader-list pull-left">
                                    <div class="thumbnail">
                                        <a data-magnify="gallery" href="{$v}">
                                            <img src="{$v}" style="height:25px">                                      
                                        </a>                                 
                                    </div>
                                 </div>
								{/foreach}
								</td>
                            </tr>
							<tr>
                                <td style="width: 15%;"><b>退货商品</b></td>
								<td>
									<table class="table table-striped table-bordered" style="vertical-align:top">								
										<tr>
											<td width="40px"><img src="{$detail.goods_thumb|get_thumb}" width="40px" /></td>
											<td width="300px">
												<div>
												{$detail.goods_name}																						
												</div>											
												<div style="color:#999">{$detail.sku_name}</div>		
												<div style="font-size:11px;color:#999">原价：<span class="text-danger">￥{$detail.shop_price}</span></div>
												<div style="font-size:11px;color:#999">购买数量：x<span class="text-danger">{$detail.goods_num}</span></div>
												<div style="font-size:11px;color:#999">退货数量：x<span class="text-danger">{$detail.num}</span></div>										
											</td>										
										</tr>	
								    </table>	
								
								</td>
                            </tr>
						   <tr>
                                <td style="width: 15%;"><b>退款金额</b></td>
								
								<td>
								  {$detail.refund_money}
								  {eq name="$detail.status" value="0"}
								    <a href="javascript:edit_money('{$detail.id}');" >修改金额</a>
								  {/eq} 
								
								</td>
                            </tr>
							
							<tr>
                                <td style="width: 15%;"><b>下单人</b></td>
								<td>
								
								  <div style="float:left"><img src="{$detail.head_img|get_thumb}" width="40px" /></div>
								  <div>{$detail.user_nickname}， {$detail.mobile}</div>
								</td>
                            </tr>
						  <tr>
                                <td style="width: 15%;"><b>处理状态</b></td>
								<td>								
								
								  {if condition="$detail.status eq 0"}
										处理中
								  {elseif condition="$detail.status neq 0"/} 
										已处理 【
												{if condition="$detail.status eq 1"}
												<font color="#00FF00">同意退</font>
												{elseif condition="$detail.status eq -1"/}
												<font color="#FF0000">驳回退</font>
												{elseif condition="$detail.status eq -2"/}
												<font color="#FF0000">已撤销</font>
												{elseif condition="$detail.status eq 2"/}
												<font color="#0000FF">待打款</font>
												{elseif condition="$detail.status eq 3"/}
												<font color="#666666">已打款</font>
												{/if}
												】
								 {elseif condition="$detail.status neq -2"/} 
										 已取消
								 {/if}
								
								
								</td>
                            </tr>
							{eq name="$detail.status" value="-1"}
							<tr>
                                <td style="width: 15%;"><b>驳回原因</b></td>
								<td>
									{$detail.refund_reject}
								</td>
                            </tr>
							{/eq}
							{notempty name="$detail.receiver_name" value="-1"}
							<tr>
                                <td style="width: 15%;"><b>收件地址</b></td>
								<td>
									{$detail.receiver_name},{$detail.receiver_mobile},{$detail.receiver_address}<br />{$detail.receiver_remark}
								</td>
                            </tr>
							{/notempty}
							{notempty name="$detail.express_no" }
							<tr>
                                <td style="width: 15%;"><b>物流信息</b></td>
								<td>		
									运单号：<a href="{:url('refund_express',['rfid'=>$detail.id,'layer'=>1,'reload'=>1])}" data-toggle="dialog-right">{$detail.express_no}</a> ，
									快递公司：{$detail.express_company.name ?? "其他"}
								</td>
                            </tr>
							{/notempty}
						   <tr>
                                <td style="width: 15%;"><b>操作</b></td>
								<td>	
								{if condition="$detail.status eq 0"}
									{eq name="$detail.refund_type" value="1"}
                                       <a title="退货通过且打款" href="{:url('refund_sure',['rfid'=>$detail.id])}" class="btn btn-xs mr5 btn-success btn-flat  confirm ajax-get"><i class="fa fa-check-circle pr5"></i>退货通过</a>
										<a title="标记打款且通过" href="{:url('refund_sure',['rfid'=>$detail.id,'nopay'=>1])}" class="btn btn-xs mr5 btn-warning btn-flat confirm ajax-get" data-title="请确认已通过非线上途径打款，标记打款后系统不会执行三方转账操作。">
										  <i class="fa fa-exclamation pr5"></i>标记通过
									   </a>	
									{else /}
									 <a  title="退货通过" href="{:url('refund_sure',['rfid'=>$detail.id,'layer'=>1,'reload'=>1])}" class="btn btn-xs mr5 btn-success btn-flat" data-toggle="dialog-right"><i class="fa fa-check-circle pr5"></i>退货通过</a>
									{/eq}
								   
								   <a title="退货驳回" href="{:url('refund_del',['rfid'=>$detail.id,'layer'=>1,'reload'=>1])}" class="btn btn-xs mr5 btn-danger btn-flat" data-toggle="dialog-right"><i class="fa fa-ban pr5"></i>退货驳回</a>
			                    {else/}
			                   	   {if condition="$detail.status eq 1"}
                                      {notempty name="$detail.express_no" } 
                                        <a  title="确认收货" href="{:url('refund_change_status',['val'=>2,'rfid'=>$detail.id])}" class="btn btn-xs mr5 btn-info btn-flat confirm ajax-get"><i class="fa fa-check-circle pr5"></i>确认收货</a>
								        <div style="color:red">请待收到退货后，再点击确认收货</div>
                                    
                                      {else /}
                                        <a  title="确认收货" href="javascript:;" class="btn btn-xs mr5 btn-info btn-flat disabled"><i class="fa fa-check-circle pr5"></i>确认收货</a>
								        <div style="color:red">请待收到退货后，再点击确认收货</div>
                                        
                                    {/notempty}                                   
                                   
								  {elseif condition="$detail.status eq 2" /}
								   <a title="打款账户" href="{:url('refund_change_status',['val'=>3,'rfid'=>$detail.id])}" class="btn btn-xs mr5 btn-danger btn-flat confirm ajax-get"><i class="fa fa-check-circle pr5"></i>打款账户</a>
								 							  
							  	   <a title="标记已打款" href="{:url('refund_change_status',['val'=>3,'rfid'=>$detail.id,'nopay'=>1])}" class="btn btn-xs mr5 btn-warning btn-flat confirm ajax-get" data-title="请确认已通过非线上途径打款，标记打款后系统不会执行三方转账操作。">
								      <i class="fa fa-exclamation pr5"></i>标记已打款
								   </a>								  
							  	   <div class="alert alert-default mt10">点击“打款账户”，系统会原路退回到付款账户（支付方式）。若点击“标记已打款”，系统只会记录状态，并不会将款项退还</div>
								 
								  {/if}
								{/if}
								</td>
								
								 
                            </tr>
							
                            </tbody>
                        </table>
                    </div>                  
                </div>
                <div class="clearfix"></div>
                <div class="box-header with-border">
                    <h5 class="box-title" style="font-size: 14px;">订单商品信息</h5>
                </div>
                <table class="table table-builder table-hover table-bordered table-striped mb10">
                    <thead>
                    <th class="">ID</th>
                    <th class="">商品名称</th>
                    <th class="">缩略图</th>
                    <th class="">售价</th>
                    <th class="">数量</th>
                    <th class="">规格</th>
                    </thead>
                    <tbody>
                    {volist name="$order_info.order_goods" id="g"}
                    <tr>
                        <td class=""> {$g.goods_id} </td>
                        <td class=""> {$g.goods_name} </td>
                        <td class=""><img data-original="{$g.goods_id}" src="{$g.goods_thumb|get_file_url}" alt="" style="width:25px;height:25px;" /></td>
                        <td class=""> {$g.shop_price}</td>
                        <td class=""> {$g.num}</td>
                        <td class=""> {$g.sku_name} </td>
                        {/volist}
                    </tbody>
                </table>
                <div class="clearfix"></div>
              
            </div>

        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>

function edit_money(id){

	layer.open({
		id:1,
        type: 1,
        title:'请输入金额',
        skin:'layui-layer-rim',
        area:['240px', 'auto'],        
        content: '<div style="padding:15px"><input id="edit_money_text" type="number" class="form-control" placeholder="请输入退款金额"></div>',
        btn:['保存','取消'],
        btn1: function (index,layero) {		  
			var money = $("#edit_money_text").val();	
			if(!money){
				layer.msg("请输入金额");
				return false;
			}
			layer.close(index);
			$.post('{:url("refund_edit_money")}',{id:id,money:money},function(res){
				layer.msg(res.msg);
				if (res.code) {
					window.location.reload()
				}
			})
    	},
        btn2:function (index,layero) {
        	 layer.close(index);
        }
 
	})
}
</script>
{/block}
